package drone.basis.express ;

import com.googlecode.aviator.runtime.function.AbstractFunction ;
import com.googlecode.aviator.runtime.function.FunctionUtils ;
import com.googlecode.aviator.runtime.type.AviatorDouble ;
import com.googlecode.aviator.runtime.type.AviatorObject ;

import java.util.Map ;

public class FuncU48 extends AbstractFunction
{

	@Override
	public AviatorObject call (
			Map < String , Object > env ,
			AviatorObject arg1 ,
			AviatorObject arg2 ,
			AviatorObject arg3 ,
			AviatorObject arg4 ,
			AviatorObject arg5 ,
			AviatorObject arg6
	)
	{
		long b1 = FunctionUtils.getNumberValue ( arg1 , env ).intValue ( ) ;
		long b2 = FunctionUtils.getNumberValue ( arg2 , env ).intValue ( ) ;
		long b3 = FunctionUtils.getNumberValue ( arg3 , env ).intValue ( ) ;
		long b4 = FunctionUtils.getNumberValue ( arg4 , env ).intValue ( ) ;
		long b5 = FunctionUtils.getNumberValue ( arg5 , env ).intValue ( ) ;
		long b6 = FunctionUtils.getNumberValue ( arg6 , env ).intValue ( ) ;
		return new AviatorDouble ( ( double ) ( b6 + b5 * 256 + b4 * 65536 + b3 * 16777216L + b2 * 4294967296L + b1 * 1099511627776L ) ) ;
	}

	public String getName ( )
	{
		return "u48" ;
	}
}
